//
//  headerView.m
//  111
//
//  Created by shc on 2018/5/22.
//  Copyright © 2018年 MacBook. All rights reserved.
//

#import "headerView.h"

@implementation headerView
// 重写初始化方法
- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        
        self.backgroundColor = [UIColor cyanColor];
        stateView = [[UIImageView alloc]initWithFrame:CGRectMake(6, 6, 17, 17)];
//        stateView.image = [UIImage imageNamed:@"close"];
//        stateView.image = [UIImage imageNamed:@"1"];
        
        [self addSubview:stateView];
        
        groupNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 5, 150, 20)];
        
        groupNameLabel.backgroundColor = [UIColor clearColor];
        
        [self addSubview:groupNameLabel];
    }
    return self;
}
// 重写
-(void)setGroupName:(NSString *)theName{
    
    //    _groupName = [theName copy];
    _groupName = theName;
    groupNameLabel.text = _groupName;
}

-(void)setOpen:(BOOL)theOpen
{
    _open = theOpen;
    
    if (_open) {
        stateView.image = [UIImage imageNamed:@"1"];
    }else {
        stateView.image = [UIImage imageNamed:@"3"];
    }
}


@end
